
package juc.base;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.LockSupport;

public class LockSupportDemo {
    /*守护线程*/
    public static void main(String[] args) throws Exception {
        Thread t1 = new Thread(() -> {
            System.out.println("t1 start");
            LockSupport.park();
            System.out.println("t1 end");
        });
        t1.start();
        TimeUnit.SECONDS.sleep(2);
        LockSupport.unpark(t1);
    }
}